package com.dehui.traders.ui.viewmodle;

import android.content.Context;
import android.databinding.ObservableInt;
import android.graphics.Color;
import android.widget.Toast;

import com.dehui.traders.R;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

/**
 * Created by hqq on 18.4.2.
 */

public class TheIndexMarketViewModel extends BaseViewModel{

    private int selectType;

    public ObservableInt stockColor = new ObservableInt();

    public ObservableInt bondColor = new ObservableInt();

    public BindingCommand stockIndexFuturesOnClickCommand = new BindingCommand(()->{
        selectType = 0;
        setTextColorChange();
    });

    public BindingCommand bondFuturesOnClickCommand = new BindingCommand(()->{
        selectType = 1;
        setTextColorChange();
    });

    private void setTextColorChange() {
        if (selectType == 0){
            stockColor.set(context.getResources().getColor(R.color.text_orange));
            bondColor.set(context.getResources().getColor(R.color.white));
        }else{
            stockColor.set(context.getResources().getColor(R.color.white));
            bondColor.set(context.getResources().getColor(R.color.text_orange));
        }
    }

    public TheIndexMarketViewModel(Context context) {
        super(context);
        stockColor.set(context.getResources().getColor(R.color.text_orange));
        bondColor.set(context.getResources().getColor(R.color.white));
    }
}
